﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Easy.Authorization.Business;
using Easy.Authorization.Models;
using Easy.Common.RegisterType;
using Easy.Common.Transaction;
using Easy.Common.Exceptions;


namespace Easy.Authorization.Service
{
    [ExceptionCallHandler]
    class Aut_UsersService : IAut_UsersService
    {
        Aut_UsersBusiness _aut_UsersBusiness { get; set; }

        public Aut_UsersService(Aut_UsersBusiness aut_UsersBusiness)
        {
            _aut_UsersBusiness = aut_UsersBusiness;
        }

        [TransactionCallHandler]
        public void CreateNew(Aut_Users aut_User)
        {
            _aut_UsersBusiness.CreateNew(aut_User);
        }

        [TransactionCallHandler]
        public void Update(Aut_Users aut_User)
        {
            _aut_UsersBusiness.Update(aut_User);
        }

        [TransactionCallHandler]
        public void Delete(Aut_Users aut_User)
        {
            _aut_UsersBusiness.Delete(aut_User);
        }

        public IQueryable<Aut_Users> GetPaged(int pageIndex = 0, int pageCount = 25, string where = "", string orderBy = "")
        {
            return _aut_UsersBusiness.GetPaged(pageIndex, pageCount, where, orderBy);
        }

        public Aut_Users FindById(Guid id)
        {
            return _aut_UsersBusiness.FindById(id);
        }

        public Aut_Users FindByUserame(string username)
        {
            return _aut_UsersBusiness.FindByUserame(username);
        }
    }
}
